<script>
$("#emailviews").click(function() {
var emailids = $("#emailids");

$.ajax({
	url:"admin/emailread.php?ids="+emailids.val(),
	success:function(data){
	location.reload();
		
	}
	
	});



});

</script>
<?php 
include("../db_connect.php");

$sql = mysql_query("select  count(*)as ilan from tblmessage where view='no'")or die(mysql_error());
$sql2 = mysql_query("select  * from tblmessage where view='no'")or die(mysql_error());
if(mysql_num_rows($sql) <1 || mysql_num_rows($sql2) <1 ){
	echo '<div style="padding:10px;"><h3 style="color:white;" >You Dont have any new Messages</h3></div>';
}else{
	$ids ="";
	while($row = mysql_fetch_array($sql)){
		
		$ilan = $row['ilan'];
	}
	while($row = mysql_fetch_array($sql2)){
		
		$ids .= $row['id'].",";
	}

	echo '<div style="padding:10px;"><a href="http://www.yahoo.com" target="_blank" id="emailviews"><h3 style="color:white; font-size:20px;" >
		 You have '.$ilan.' message Please check your email</h3></a>
		<input type="hidden" id="emailids" value="'.$ids.'"/>
	</div>';


}


?>